package featuremodel.constraint;

import java.util.Vector;

import featuremodel.FeatureModelDef;
import featuremodel.method.AlternativeMethodNone;
import featuremodel.method.AlternativeMethodOne;

import skyblue.Constraint;
import skyblue.Strength;
import skyblue.Variable;

public class AlternativeConstraint extends Constraint {
	
	private Variable parent;
	private Vector<Variable> children;

	public AlternativeConstraint(Variable parent, Vector<Variable> children,
			Strength strength) {
		
		super(strength);
		this.constraintType = FeatureModelDef.ALTERNATIVE_CONSTRAINT;
		this.setParent(parent);
		this.setChildren(children);
		getVariables().add(parent);
		getVariables().addAll(children);

		AlternativeMethodOne amo;
		for (int j = 0; j < children.size(); j++) {
			amo = new AlternativeMethodOne(parent, children.get(j), children);
			getMethods().add(amo);
		}

		getMethods().add(new AlternativeMethodNone(parent, children));

	}


	public void setParent(Variable parent) {
		this.parent = parent;
	}

	public Variable getParent() {
		return parent;
	}

	public void setChildren(Vector<Variable> children) {
		this.children = children;
	}

	public Vector<Variable> getChildren() {
		return children;
	}

}
